package edu.gyc.hiseckill.error;

public enum BusinessErrorEnum implements CommonError {

    PARAMETER_VALIDATION_ERROR(10001, "参数校验非法"),
    ITEM_SAVE_ERROR(10003, "商品入库失败"),
    STOCK_ENOUGH_ERROR(30001, "库存不足"),
    UNKNOWN_ERROR(10002, "未知错误"),
    USER_NOT_EXIST(20001, "用户不存在"),
    USER_NOT_LOGIN(20003, "用户未登录"),
    LOGIN_FAIL(20002, "手机号或者密码错误");

    private int errCode;
    private String errMsg;

    BusinessErrorEnum(int errCode, String errMsg) {
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    @Override
    public int getErrorCode() {
        return errCode;
    }

    @Override
    public String getErrorMessage() {
        return errMsg;
    }

    @Override
    public CommonError setErrorMessage(String errorMessage) {
        this.errMsg=errorMessage;
        return this;
    }
}
